export const FailureRate = {
    title: {
        top: '20px',
        text: "整线设备故障率",
        left: 'center'
    },
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'cross',
            crossStyle: {
                color: '#999'
            }
        }
    },
    legend: {
        data: ['故障率（含调试）', '故障率（不含调试）', '故障率目标'],
        bottom: '0'
    },
    xAxis: [
        {
            type: 'category',
            data: ['正极匀浆', '负极匀浆', '正极涂布', '负极涂布', '正极辊压', '负极辊压', '切叠1'],
            axisPointer: {
                type: 'shadow'
            },

            axisLabel: {
                rotate: 30
            }
        }
    ],
    yAxis: [
        {
            type: 'value',
            // name: 'Precipitation',
            min: 0,
            max: 250,
            interval: 50,
            axisLabel: {
                formatter: '{value} %'
            }
        }
    ],
    series: [
        {
            name: '故障率（含调试）',
            type: 'bar',
            tooltip: {
                valueFormatter: function (value) {
                    return value;
                }
            },
            itemStyle: {
                color: '#4874cb',
            },
            data: [
                2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3
            ]
        },
        {
            name: '故障率（不含调试）',
            type: 'line',
            itemStyle: {
                color: '#ee822f',
            },
            tooltip: {
                valueFormatter: function (value) {
                    return value;
                }
            },
            data: [
                2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3
            ]
        },
        {
            name: '故障率目标',
            type: 'line',
            itemStyle: {
                color: '#ff0000',
            },
            tooltip: {
                valueFormatter: function (value) {
                    return value + ' %';
                }
            },
            data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
        }
    ]
}

export const DeviceStatus = {
    title: {
        text: '设备实时状态',
        left: 'center'
    },
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        }
    },
    legend: {
        bottom: 0
    },
    grid: {
        left: '3%',
        right: '6%',
        bottom: "10%",
        containLabel: true
    },
    xAxis: {
        type: 'value',
        boundaryGap: [0, 0.01]
    },
    yAxis: {
        type: 'category',
        data: ['Brazil', 'Indonesia', 'USA', 'India', 'China', 'World']
    },
    series: [
        {
            name: '系列1',
            type: 'bar',
            data: [18203, 23489, 29034, 104970, 131744, 630230]
        },
        {
            name: '系列2',
            type: 'bar',
            data: [19325, 23438, 31000, 121594, 134141, 681807]
        }
    ]
};


const list = [
    {
        option1: {
            title: {
                top: '20px',
                text: "正极匀浆故障率",
                left: 'center',
                textStyle: {
                    fontSize: '16px',
                    fontWeight: 'normal',
                }
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross',
                    crossStyle: {
                        color: '#999'
                    }
                }
            },
            grid: {
                left: '3%',
                right: '3%',
                bottom: "0%",
                containLabel: true
            },
            legend: {
                show: false,
                data: ['故障数', '故障率'],
                bottom: '0'
            },
            xAxis: [
                {
                    type: 'category',
                    data: ['W17', 'W19', 'W20', '5月11日', '5月12日', '5月13日', '5月14日', '5月15日', '5月16日', '5月17日'],
                    axisPointer: {
                        type: 'shadow'
                    },
                    axisLabel: {
                        rotate: 90
                    }
                }
            ],
            yAxis: [
                {
                    type: 'value',
                    min: 0,
                    max: 3000,
                    interval: 1000,
                    // axisLabel: {
                    //     formatter: '{value} %'
                    // }
                },
                {
                    type: 'value',
                    min: 0,
                    max: 30,
                    interval: 10,
                    axisLabel: {
                        formatter: '{value} %'
                    }
                }
            ],
            series: [
                {
                    name: '故障数',
                    type: 'bar',
                    tooltip: {
                        valueFormatter: function (value) {
                            return value;
                        }
                    },
                    itemStyle: {
                        color: '#4874cb',
                    },
                    // 根据百分比算数量
                    data:
                        [
                            1.4, 2.6, 6.9, 7.9, 0.0, 11.9, 4.0, 11.1, 10.0, 3.2
                        ].map((item) => parseInt((item / 100 * 3000).toFixed(1)))
                    // [
                    //     42, 78, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3
                    // ]
                },
                {
                    name: '故障率',
                    type: 'line',
                    itemStyle: {
                        color: '#ee822f',
                    },
                    yAxisIndex: 1,
                    tooltip: {
                        valueFormatter: function (value) {
                            return value + '%';
                        }
                    },
                    data: [
                        1.4, 2.6, 6.9, 7.9, 0.0, 11.9, 4.0, 11.1, 10.0, 3.2
                    ]
                },
            ]
        },
        option2: {
            title: {
                top: '20px',
                text: "正极匀浆故障分类",
                left: 'center',
                textStyle: {
                    fontSize: '16px',
                    fontWeight: 'normal',
                }
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross',
                    crossStyle: {
                        color: '#999'
                    }
                }
            },
            grid: {
                left: '3%',
                right: '3%',
                bottom: "0%",
                containLabel: true
            },
            legend: {
                data: ['故障数', '故障率'],
                bottom: '0',
                show: false
            },
            xAxis: [
                {
                    type: 'category',
                    data: ['RGV对1111111111', '立库...', '行吊卡死', 'sp落料', '机械结...', '配件损坏'],
                    axisPointer: {
                        type: 'shadow'
                    },
                    axisLabel: {
                        rotate: 30,
                        formatter: function (value, index) {
                            if (value.length > 5) {
                                return value.substring(0, 5) + '...';
                            } else {
                                return value;
                            }
                        }
                    },
                }
            ],
            yAxis: [
                {
                    type: 'value',
                    // name: 'Precipitation',
                    min: 0,
                    max: 300,
                    interval: 100,
                    axisLabel: {
                        formatter: '{value}'
                    }
                },
                {
                    type: 'value',
                    min: 0,
                    max: 100,
                    interval: 50,
                    axisLabel: {
                        formatter: '{value} %'
                    }
                }
            ],
            series: [
                {
                    name: '故障数',
                    type: 'bar',
                    tooltip: {
                        valueFormatter: function (value) {
                            return value;
                        }
                    },
                    itemStyle: {
                        color: '#4874cb',
                    },
                    data: [
                        44.1, 60.6, 73.8, 83.5, 90.1, 95.0
                    ].map((item) => parseInt((item / 100 * 300).toFixed(1)))
                },
                {
                    name: '故障率',
                    type: 'line',
                    itemStyle: {
                        color: '#ee822f',
                    },
                    yAxisIndex: 1,
                    tooltip: {
                        valueFormatter: function (value) {
                            return value;
                        }
                    },
                    data: [
                        44.1, 60.6, 73.8, 83.5, 90.1, 95.0
                    ]
                }
            ]
        }
    },
]

// 单机故障率
export const MachineFailureRate = list.concat(list)


export const EquipmentShutdownInfo = {
    option1: {
        title: {
            text: "报警时长统计",
            left: "left",
            textStyle: {
                fontSize: '16px',
                fontWeight: 'normal',
            }
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'cross',
                crossStyle: {
                    color: '#999'
                }
            }
        },
        grid: {
            left: '3%',
            right: '6%',
            bottom: "0%",
            containLabel: true
        },
        legend: {
            data: ['今日', '昨日'],
            left: "right"
        },
        xAxis: [
            {
                type: 'category',
                data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
                axisPointer: {
                    type: 'shadow'
                }
            }
        ],
        yAxis: [
            {
                type: 'value',
                name: '昨日',
                min: 0,
                max: 60,
                interval: 20,
                axisLabel: {
                    formatter: '{value}'
                }
            }
        ],
        series: [
            {
                name: '今日',
                type: 'bar',
                tooltip: {
                    valueFormatter: function (value) {
                        return value;
                    }
                },
                data: [
                    2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3
                ]
            },
            {
                name: '昨日',
                type: 'bar',
                tooltip: {
                    valueFormatter: function (value) {
                        return value;
                    }
                },
                itemStyle: {
                    color: '#ee822f',
                },
                data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
            }
        ]
    },
    option2: {
        title: {
            text: "报警时长解决时长",
            left: "left",
            textStyle: {
                fontSize: '16px',
                fontWeight: 'normal',
            }
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'cross',
                crossStyle: {
                    color: '#999'
                }
            }
        },
        legend: {
            data: ['报警时长', '解决时长'],
            left: "right"
        },
        grid: {
            left: '3%',
            right: '3%',
            bottom: "0%",
            containLabel: true
        },
        xAxis: [
            {
                type: 'category',
                data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
                axisPointer: {
                    type: 'shadow'
                }
            }
        ],
        yAxis: [
            {
                type: 'value',
                name: '解决时长',
                min: 0,
                max: 25,
                interval: 5,
                axisLabel: {
                    formatter: '{value}'
                }
            }
        ],
        series: [
            {
                name: '报警时长',
                type: 'line',
                tooltip: {
                    valueFormatter: function (value) {
                        return value;
                    }
                },
                data: [
                    2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3
                ]
            },
            {
                name: '解决时长',
                type: 'line',
                tooltip: {
                    valueFormatter: function (value) {
                        return value;
                    }
                },
                data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2]
            }
        ]
    },
}
